#ifndef EBSTATE_H
#define EBSTATE_H

#include <QWidget>
#include <QTimer>


namespace Hydra_Eb {
typedef enum _eb_state{
    INIT,                                       // 初始态
    ALARM,                                      // 超过推荐速度
    EB                                          // 超过限速
}EB_STATE;
}

using namespace Hydra_Eb;

class EbState : public QWidget
{
    Q_OBJECT
public:
    explicit EbState(QWidget *parent = nullptr);
    void setInterval(quint16 interval);
    void setState(EB_STATE state);

public slots:
    void refresh();

protected:
    void paintEvent(QPaintEvent *event);
    void resizeEvent(QResizeEvent *event);
    void initParam();
    void drawImage(QPainter *pPainter);

private:
    QTimer mTimer;
    QRect mEbRect;
    EB_STATE mState = EB_STATE::INIT;
    QColor mAlarmColor = QColor(234, 145, 0);
    QColor mEbColor = QColor(189, 0, 0);

signals:

};

#endif // EBSTATE_H
